#include <stdio.h>

typedef int(*callback_t)(void*,void*);

int comp (callback_t f, void* para1, void* para2)
{
    return f (para1, para2);
}

int comp_int (const int a, const int b)
{
    return a - b;
}

int comp_str (const char* a, const char* b)
{
    int count = 0;
    while ( *(a+count) != '\0' && *(b+count) != '\0' )
    {
        if ( (*(a+count) - *(b+count)) != 0 )
        {
            return *(a+count) - *(b+count);
        }
        count++;
    }
    return 0;
}

int main ()
{
    printf ("%d \n", comp((callback_t)comp_int, (void*)2, (void*)5));
    printf ("%d \n", comp((callback_t)comp_int, (void*)6, (void*)5));
    printf ("%d \n", comp((callback_t)comp_str, (void*)"nihao", (void*)"nihao"));
    printf ("%d \n", comp((callback_t)comp_str, (void*)"nihao1", (void*)"nihao2"));
    printf ("%d \n", comp((callback_t)comp_str, (void*)"fihao1", (void*)"nihao2"));
    printf ("%d \n", comp((callback_t)comp_str, (void*)"fih", (void*)"nihao2"));
    printf ("%d \n", comp((callback_t)comp_str, (void*)"zih", (void*)"hao2"));
    return 0;
}
